package com.wanyu.video.nio.buffer;

import java.nio.IntBuffer;

/**
 * 了解基础Buffer
 */
public class BasicBuffer {


    public static void main(String[] args) {
        IntBuffer intBuffer = IntBuffer.allocate(5);
        for (int i = 0; i < 5; i++) {
            intBuffer.put(i);
        }

        // 将buffer进行转换，才能读取数据
        intBuffer.flip();
        while(intBuffer.hasRemaining()){
            System.out.println(intBuffer.get());
        }
    }
}
